package com.ruoyi.canteen.mapper;

import java.util.List;
import com.ruoyi.canteen.domain.CanteenMdDeliver;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

/**
 * 门店配送时间Mapper接口
 * 
 * @author zhangw
 * @date 2021-09-30
 */
public interface CanteenMdDeliverMapper 
{
    /**
     * 查询门店配送时间
     * 
     * @param id 门店配送时间主键
     * @return 门店配送时间
     */
    public CanteenMdDeliver selectCanteenMdDeliverById(Long id);

    /**
     * 查询门店配送时间列表
     * 
     * @param canteenMdDeliver 门店配送时间
     * @return 门店配送时间集合
     */
    public List<CanteenMdDeliver> selectCanteenMdDeliverList(CanteenMdDeliver canteenMdDeliver);

    /**
     * 新增门店配送时间
     * 
     * @param canteenMdDeliver 门店配送时间
     * @return 结果
     */
    public int insertCanteenMdDeliver(CanteenMdDeliver canteenMdDeliver);

    /**
     * 修改门店配送时间
     * 
     * @param canteenMdDeliver 门店配送时间
     * @return 结果
     */
    public int updateCanteenMdDeliver(CanteenMdDeliver canteenMdDeliver);

    /**
     * 删除门店配送时间
     * 
     * @param id 门店配送时间主键
     * @return 结果
     */
    public int deleteCanteenMdDeliverById(Long id);

    /**
     * 批量删除门店配送时间
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteCanteenMdDeliverByIds(Long[] ids);

    /**
     * 根据当前门店选择在用的配送时间
     * @param mdId
     * @return
     */
    @Select("SELECT id,md_id,dept_id,order_beg_time,order_end_time,deliver_time,deliver_name " +
            "FROM canteen_md_deliver where delete_time is NULL and md_id=#{mdId}")
    @Results({
            @Result(property = "id",column = "id"),
            @Result(property = "mdId",column = "md_id"),
            @Result(property = "deptId",column = "dept_id"),
            @Result(property = "orderBegTime",column = "order_beg_time"),
            @Result(property = "orderEndTime",column = "order_end_time"),
            @Result(property = "deliverTime",column = "deliver_time"),
            @Result(property = "deliverName",column = "deliver_name")
    })
    public List<CanteenMdDeliver> selectCurDeliverListByMdId(Long mdId);


}
